package com.trailer.base.utils;

import android.content.ClipboardManager;

import com.trailer.base.base.BApp;

import static android.content.Context.CLIPBOARD_SERVICE;

public class ClipboardUtils {


    public static String getClipBoardText() {

        ClipboardManager clipboardManager = (ClipboardManager) BApp.instance().getSystemService(CLIPBOARD_SERVICE);
        if (clipboardManager == null) {
            return null;
        }

        if (clipboardManager.hasPrimaryClip() && clipboardManager.getPrimaryClip().getItemCount() > 0) {
            CharSequence addedText = clipboardManager.getPrimaryClip().getItemAt(0).getText();
            return addedText.toString();
        }

        return null;
    }
}
